﻿using System;
using Microsoft.Extensions.Logging;

namespace Micro.Extensions.Bridge
{
    /// <summary>
    /// ConsulLog
    /// </summary>
    public static class LogBridgeExtensions
    {
        private static readonly EventId SpiderEventId = new EventId(-111, "BridgeLog");
        public static void LogBridge(this ILogger logger, LogLevel logLevel, string message, Exception exception = null)
        {
            logger.Log(logLevel, SpiderEventId, message, exception, (m, e) => m);
        }

        internal static void LogBridgeDebug(this ILogger logger, string message, params object[] args)
        {
            logger.LogDebug(SpiderEventId, message, args);
        }

        internal static void LogBridgeError(this ILogger logger, Exception ex, string message)
        {
            logger.Log(LogLevel.Error, SpiderEventId, message, ex, (m, e) => m);
        }
    }
}
